package net.xdclass.controller;


import net.xdclass.service.LinkSafetyService;
import net.xdclass.util.JsonData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.concurrent.ExecutionException;

@RestController
@RequestMapping("/api/link-safety")
public class LinkSafetyController {

    @Autowired
    private LinkSafetyService linkSafetyService;

    @GetMapping("/check")
    public JsonData checkLink(@RequestParam String url) throws ExecutionException, InterruptedException {
        return JsonData.buildSuccess(linkSafetyService.checkLink(url));
    }
}
